package com.vict.job;

import com.vict.GuiApplication;
import com.vict.config.Common;
import com.vict.config.CompleteScheduleConfig;
import com.vict.config.SettingConfig;
import com.vict.util.LockJdk;
import com.vict.util.TimeUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
// import org.springframework.scheduling.support.CronExpression;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Optional;

@Slf4j
@Component
public class Job {

    @Scheduled(cron = "0/1 * * * * ? ")
    public void time() {
        Optional.ofNullable(GuiApplication.guiApplication).map(o-> o.getMainWindow())
                .ifPresent(o-> o.setTitle(Common.winName + " " + TimeUtil.getTimeStr("yyyy-MM-dd HH:mm:ss", System.currentTimeMillis())));
    }

    public void init(){

    }




}
